package com.yuzhihao.writejvm.attributes.runtimevta;

import com.yuzhihao.writejvm.clazz.ClassInfo;
import com.yuzhihao.writejvm.read.Parse;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.log4j.Log4j2;

import java.io.DataInputStream;
import java.io.IOException;

/**
 * The items of the target_info union (except for the first) specify precisely which type in a declaration or expression is annotated.
 * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.20.1">MethodFormalParameterTarget</a>
 *
 * @author yzh
 * @since 2021年12月11日17:05:51
 */
@Data
@Log4j2
@EqualsAndHashCode(callSuper = true)
public class MethodFormalParameterTarget extends TypeAnnotation {

    private int path_length_u1 = 1;

    private int path_length;

    public MethodFormalParameterTarget(int tag){
        super();
        super.setTarget_type(tag);
    }

    @Override
    public void parse(DataInputStream dis, ClassInfo ci) {

        try {
            this.path_length = Parse.byteToInt(this.path_length_u1, dis);

        } catch (IOException e) {
            log.error(e);
        }

    }

}
